<include file="Public/min-header"/>

<div class="wrapper">
    <include file="Public/breadcrumb"/>
	<section class="content">
       <div class="row">
       		<div class="col-xs-12">
	       		<div class="box">
	           	<div class="box-header">
	               <nav class="navbar navbar-default">	     
				        <div class="collapse navbar-collapse">
				          <form class="navbar-form form-inline" action="{:U('Activity/activity_list')}" method="post">
                          <!--
				            <div class="form-group">
				              	<input type="text" name="keywords" class="form-control" placeholder="搜索">
				            </div>
				            <button type="submit" class="btn btn-default">提交</button>
                           --> 
				            <div class="form-group pull-right">
					            <a href="{:U('Activity/activity_info')}" class="btn btn-primary pull-right"><i class="fa fa-plus"></i>添加活动</a>
				            </div>		          
				          </form>		
				      	</div>
	    			</nav>                
	             </div>	    
	             <!-- /.box-header -->
	             <div class="box-body">	             
	           		<div class="row">
	            	<div class="col-sm-12">
		              <table id="list-table" class="table table-bordered table-striped dataTable">
		                 <thead>
		                   <tr role="row">
			                   <th class="sorting" tabindex="0" style="width:50px; text-align:center;">ID</th>
			                   <th class="sorting" tabindex="0">活动名称</th>
			                   <th class="sorting" tabindex="0" style="width:50px; text-align:center;">状态</th>
			                   <th class="sorting" tabindex="0" style="width:130px; text-align:center;">开始时间</th>
			                   <th class="sorting" tabindex="0" style="width:130px; text-align:center;">结束时间</th>
			                   <th class="sorting" tabindex="0" style="width:150px; text-align:center;">操作</th>
		                   </tr>
		                 </thead>
						<tbody>
						  <foreach name="activity_list" item="vo" key="k" >
						  	<tr role="row" align="center">
		                     <td>{$vo.id}</td>
		                     <td style="text-align:left;">{$vo.name}</td>
							 <td>
                              <img width="20" height="20" src="__PUBLIC__/images/<if condition='$vo[is_close] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('activity','id','{$vo.id}','is_close',this)"/></td>
		                     <td>{$vo.start_time|date='Y-m-d H:i',###}</td>
							 <td>{$vo.end_time|date='Y-m-d H:i',###}</td>
							 <td>
		                      <a class="btn btn-primary" href="{:U('Activity/activity_info',array('id'=>$vo['id']))}"><i class="fa fa-pencil"></i></a>
                              
                             
		                      <a  data-url="{:U('activity_del',array('id'=>$vo['id']))}" onclick="delfun(this)" href="javascript:;" data-toggle="tooltip" data-id="{$vo['id']}" title="" class="btn btn-danger" data-original-title="删除"><i class="fa fa-trash-o"></i></a>
							</td>
		                   </tr>
		                  </foreach>
		                   </tbody>
		               </table>
	               </div>
	          </div>
              <div class="row">
              	    <div class="col-sm-6 text-left"></div>
                    <div class="col-sm-6 text-right">{$page}</div>		
              </div>
	          </div><!-- /.box-body -->
	        </div><!-- /.box -->
       	</div>
       </div>
   </section>
</div>


<script>

function delfun(obj){
	layer.confirm('确认删除？', {
    		  btn: ['确定','取消'] //按钮
    		}, function(){
			$.ajax({
				type : 'post',
				url : $(obj).attr('data-url'),
				dataType : 'json',
				success : function(data){
					if(data){
						$(obj).parent().parent().remove();
						layer.alert('删除成功', {icon: 2});  //alert('删除失败');
					}else{
						layer.alert('删除失败', {icon: 2});  //alert('删除失败');
					}
				}
			})
		}, function(index){
    			layer.close(index);
    			return false;// 取消
    		}
	);
}
</script>
</body>
</html>